Ultimate Power Tips 1.0A (c) 1992 Scanlon Enterprises ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ ROLL YOUR OWN UTILITIES ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Roll Your Own Utilities is a section devoted to users who what the most from their system (Pushing to the Max). You don't have to be a Power User to use these utilities, nor to even make them. Everything you need, to create the utilities described here, come with DOS. You'll need : 1) DOS DEBUG.EXE (or DEBUG.COM) 2) DOS EDLIN.COM (or any good text editor) 3) Some free disk space The DOS DEBUG program, is very well known in Power User Circles, and amongst programmers. Now, it is time, for everyone else to learn the potential of this FREE program, that is included with all Microsoft DOS. DEBUG is a tool designed for aiding the programmer in debugging their software. Because Microsoft designed more into it, it is often used as a compiler! Yes, you can write a program in assembly language, and compile it, without even going out and buying a compiler. Actually, since we are talking about assembly language, this technique is called Assembling, instead of compiling. After making your first utility, from this section, you may call yourself a programmer! Not only that, you can say, that you've programmed in Assembly Language, the hardest of all programming languages! The purpose of this section, is NOT to provide you with detailed workings of DEBUG, as powerful as it may be, but to provide you with enough knowledge to create the utilities here-in. To create these utilities, you'll be using a command line (DOS prompt) similar to the following : DEBUG < filename Where, 'filename' is the name of the file we tell you to create using a text editor (or EDLIN). The redirector is used, because we are going to pretend we are entering the keystrokes found in the file 'filename'. Actually, we have, but, we have done so, in advance. The redirector tells DOS, to get keyboard input from the file 'filename', instead of the actual keyboard. Let us begin, now, with our first program! Get Available Memory Quickly Name this script file (that's what we call a file we use to execute DEBUG automatically), FM.SCR (for FreeMemory). FM.SCR N FM.COM E 100 EB 09 90 4B 20 E 105 46 72 65 65 24 E 10A 0A 2E A1 02 00 E 10F 8C CB 2B C3 B1 E 114 06 D3 E8 B9 01 E 119 00 F6 36 0A 01 E 11E 50 0A C0 74 05 E 123 32 E4 41 EB F2 E 128 58 8A D4 80 C2 E 12D 30 B4 02 CD 21 E 132 E2 F4 B4 09 BA E 137 03 01 CD 21 C3 RCX 3C W Q If you copied this correctly, you will have created your first DEBUG script file. You may be wondering what all those alpha characters are doing mixed in with the numbers (if you are a programmer or power user, you already know)? We are using what is referred to as HEX numbers, which is a numbering system based upon 16, rather that our usual base 10 (digits 0-9). For the program to work, a complete understanding, is NOT necessary. This little script, will create a program, FM.COM, which, when executed, will display the amount of available memory. By creating this program, you will no longer have to execute the DOS program CHKDSK to get the memory available. For those of you with newer DOS 5.0, you have the DOS program MEM which reports this value. However, the DOS MEM program is NOT only 60 bytes! Yes, we did say 60 bytes. The DOS MEM program is almost 40K bytes! Throw out that disk hog, and use FM! Well, we have the script, but, how do we make the program? Easy, just enter the following line : DEBUG at any DOS prompt. For those of you who do have DOS 5.0 and the program MEM, and have noticed a discrepancy in available size reporting, remember, MEM is reporting BYTES FREE, and FM is reporting K (thousands) of bytes free! To verify that FM is indeed reporting accurately, simply divide the reported amount by MEM, by 1024, to get K bytes as reported by FM. You'll see, these numbers are the same! Num Lock Off If you are using one of those 84 key (old time keyboards), or simply prefer to use cursor positioning from the numeric keypad, and want to make sure that your NumLock is Off at boot time, create the following DEBUG script file. We will name the script file "NN.SCR" for no num lock, which will make the program "NN.COM". NN.SCR A 100 MOV AX,0 MOV DS,AX AND BYTE PTR[417],DF INT 20 {empty line} RCX C N NN.COM W Q Be sure to leave the line with "{empty line}", blank. Just press the key for that line. We use "NN", as the name, for No Num Lock. Now, from a DOS prompt, type : DEBUG at a DOS prompt to set num lock off. The best use, is to put NN on a line of your AUTOEXEC.BAT file, and have AUTOEXEC automatically set num lock off at boot time. If you are having problems, or simply want to save yourself time and frustration of typing in the above script, simply load this tutorial section into your word processor, which must have blocking capability. Block the actual script section of this tutorial, and save the block as FM.SCR! Now, you won't even have to type, and, you won't get an error! This will be the last time we mention using your word processor to extract the script files from this tutorial. Just remember, you can do this with any of the script files which are listed here-in. Whoa! Notice the difference between this script and our earlier one? The first example, was using hex input, and here, we use, what is called assembly language. The difference between these two approaches, is invisible to you, the user. This tutorial, will intermix the two types of script files, Hex and Assembly, so you will become familiar with them. In this way, you'll be able to quickly enter them, from a magazine article. Lets take a moment, to cover two DEBUG script lines, the "RCX" and "N". The line containing "RCX" tells DEBUG, that we wish to set the number of bytes, for a file size, in this case, "C", next line, which is 12 decimal. Thus, we will have created a COM file (NN.COM), which is only 12 bytes long! Faster Repeat Keys This script file, will create a program to speed up repeat keys. Repeat keys, are keys which can be held down, and automatically duplicate characters. IE...Hold down the letter "k", soon, the screen will start filling up with "k". Now release the "k" key, and "k"'s stop appearing. The speed at which the k's appear, is called the repeat rate, which is what this program will speed up. We will call this script file FK.SCR, and it will make a program called FK.COM (for Fast Keys). FK.SCR A 100 MOV AX,305 MOV BX,3 INT 16 INT 20 {blank line} RCX A N FK.COM W Q Now, type : DEBUG at any DOS prompt, to speed up your key board repeat keys. However, to automatically, have this performed at boot time would be better. To do this, just place a line, with FK into your AUTOEXEC.BAT file, and from then on, each time you boot, you'll have the repeat keys speeded up. Lost Cursor Recovery If you, like me, have had your cursor become invisible after executing some program, would like some way to get it back, then enter this script. This script will create a program, that not only recovers the cursor, but will restore a screen from graphics mode, which some games leave it in. The following script is named RC.SCR, for Recover Cursor, and creates a program called "RC.COM". RC.SCR A 100 MOV AX,3 INT 10 INT 20 {Blank line} RCX 7 N RC.COM W Q This creates the smallest program yet, only 7 bytes! Now, to use, simply enter RC and press from a DOS prompt. No need to have this as part of your AUTOEXEC, unless your AUTOEXEC starts something which leaves the screen in graphics mode. To get the best use of this utility, we suggest creating a batch file to start your game or application which leaves the screen in graphics mode, or makes the cursor invisible. If your program is named "GO.EXE" then your batch file would look like this. GO RC Just a simple two line batch file! For those of you familiar with programming, you'll notice, the code sets attempts to reset the mode to MODE 3, which is 80 column by 25 line color mode. We haven't made an error, do NOT change anything. If you have a monochrome system, this will reset that back to monochrome mode! Go ahead and try it. Comparing The Size of Two Files Have you ever needed to compare the size of two different files? This script file will create a program which will do just that. The program, once created, will display the size difference between two files. Create the script file FD.SCR (for File Difference), which then can be used, with DEBUG to create FD.COM. FD.SCR N FD.COM E 100 EB 5F 90 00 00 00 00 00 E 108 00 00 00 53 79 6E 74 61 E 110 78 3A 20 46 44 20 66 69 E 118 6C 65 31 20 66 69 6C 65 E 120 32 0D 0A 24 00 00 00 00 E 128 00 00 46 69 6C 65 20 4E E 130 4F 54 20 66 6F 75 6E 64 E 138 20 6F 72 20 46 69 6C 65 E 140 20 4F 70 65 6E 20 45 72 E 148 72 6F 72 0D 0A 24 44 69 E 150 66 20 3A 20 24 24 20 42 E 158 79 74 65 73 0D 0A 24 00 E 160 00 FC BE 81 00 E8 AC 00 E 168 73 0C B4 09 BA 0B 01 CD E 170 21 B8 02 4C CD 21 89 36 E 178 03 01 FF 0E 03 01 E8 86 E 180 00 72 E7 C6 44 FF 00 E8 E 188 8A 00 72 DE 89 36 05 01 E 190 FF 0E 05 01 E8 70 00 73 E 198 06 80 7C FF 0D 75 CB C6 E 1A0 44 FF 00 8B 16 03 01 E8 E 1A8 77 00 73 07 B4 09 BA 2A E 1B0 01 EB BC A3 07 01 89 16 E 1B8 09 01 8B 16 05 01 E8 60 E 1C0 00 72 E9 8B 1E 07 01 8B E 1C8 0E 09 01 3B CA 77 0E 72 E 1D0 04 3B D8 73 08 93 86 CA E 1D8 C6 06 54 01 2D 2B D8 1B E 1E0 CA 53 51 B4 09 BA 4E 01 E 1E8 CD 21 E8 4D 00 B4 09 BA E 1F0 56 01 CD 21 59 5B B8 00 E 1F8 4C 0B DB 75 06 0B C9 75 E 200 02 CD 21 B0 01 CD 21 AC E 208 3C 20 74 06 3C 0D 75 F7 E 210 F9 C3 F8 C3 AC 3C 20 74 E 218 FB 3C 0D 75 02 F9 C3 F8 E 220 C3 B8 00 3D CD 21 72 11 E 228 8B D8 B8 02 42 2B C9 2B E 230 D2 CD 21 50 B4 3E CD 21 E 238 58 C3 8B D1 8B C3 FF 06 E 240 5F 01 8B DA 2B C9 2B D2 E 248 2B F6 BF 0A 00 E8 18 00 E 250 53 0B C0 75 E9 0B D2 75 E 258 E5 8B 0E 5F 01 5A 80 C2 E 260 30 B4 02 CD 21 E2 F6 C3 E 268 8B E9 B9 20 00 F8 D1 D0 E 270 D1 D3 D1 D5 D1 D2 73 0A E 278 2B EF 1B D6 F9 E2 EF EB E 280 0E 90 3B D6 72 06 75 F0 E 288 3B EF 73 EC F8 E2 DF D1 E 290 D0 D1 D3 8B CD 87 D3 87 E 298 CB C3 RCX 19A W Q This DEBUG script file, is fairly lengthy, as script files goes, so please be careful when entering it. Should you have problems, we strongly suggest you use a wordprocessor to extract the above and use the resultant file with DEBUG directly with DEBUG. If you have entered the above correctly, and execute the command "DEBUG NAME.BAT CALL NAME.BAT ECHO Why Hello %ASK%! The first line passes a question to our new program IN.COM, which sends its output to the file NAME.BAT, via the redirector ">". If the user responds with "Jeff" to the question, then the batch file "NAME.BAT" will contain "SET ASK=Jeff". The second line of the batch file, under DOS 3.3 and up, calls the new batch file just created from the first line. This batch file, executes the one line, "SET ASK=Jeff", which places "Jeff" into the environment variable ASK. Now, the final line can display the result, by embedding the variable name ASK inside "%" characters. This is how a batch file uses an environment variable. The variable name will be replaced by the contents of the variable, "Jeff". Thus our screen would display : Why Hello Jeff! And NOT : Why Hello %ASK%! By using this program, your batch files can add that personal touch. Other uses, of course, include password input, selecting a directory name, and almost anything you can think of, which requires a line of input. The Forgotten Rename Feature DOS forgot one important function, Directory Rename. This function is suitable for DOS 3.0 and up. If you have an earlier DOS, why NOT upgrade NOW! We'll call our final script file "DR.SCR" for Directory Rename, which will create "DR.COM" when used with DEBUG. DR.SCR N DR.COM E 100 E9 86 00 00 52 65 71 75 E 108 69 72 65 73 20 44 4F 53 E 110 20 33 2E 30 20 61 6E 64 E 118 20 75 70 0D 0A 24 00 55 E 120 73 61 67 65 20 3A 20 52 E 128 44 20 5B 64 3A 5D 5B 70 E 130 61 74 68 5D 6F 72 67 6E E 138 61 6D 65 20 6E 65 77 6E E 140 61 6D 65 0D 0A 24 00 00 E 148 00 00 20 69 73 20 4E 4F E 150 54 20 61 20 64 69 72 65 E 158 63 74 6F 72 79 0D 0A 24 E 160 00 00 00 44 69 72 65 63 E 168 74 6F 72 79 20 4E 4F 54 E 170 20 66 6F 75 6E 64 20 6F E 178 72 20 49 4E 56 41 4C 49 E 180 44 20 70 61 74 68 0D 0A E 188 24 B8 00 30 CD 21 3C 03 E 190 73 0C BA 0E 01 B4 09 CD E 198 21 B8 01 4C CD 21 BE 81 E 1A0 00 FC E8 5B 00 73 05 BA E 1A8 1F 01 EB E9 89 F2 4A E8 E 1B0 41 00 72 F3 C6 44 FF 00 E 1B8 89 F3 E8 43 00 72 E8 EE E 1C0 FE 4F E8 2E 00 73 06 80 E 1C8 7C FF 0D 75 DA C6 44 FF E 1D0 00 B8 00 43 CD 21 F7 C1 E 1D8 10 00 75 0D C6 47 FF 24 E 1E0 B4 09 CD 21 BA 4A 01 EB E 1E8 AC B4 56 CD 21 BA 63 01 E 1F0 72 A3 C3 AC 3C 20 74 06 E 1F8 3C 0D 75 F7 F9 C3 F8 C3 E 200 AC 3C 20 74 FB 3C 00 75 E 208 02 F9 C3 F8 C3 90 90 90 RCX 10D W Q Again, using DEBUG, enter the following command. DEBUG